package com.bltec.emergency.service.recordService.impl;

import com.bltec.emergency.mapper.RecordExerciseMapper;
import com.bltec.emergency.model.RecordExercise;
import com.bltec.emergency.service.recordService.RecordExerciseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RecordExerciseServiceImpl implements RecordExerciseService {
    @Resource
    RecordExerciseMapper recordExerciseMapper;
    @Override
    public boolean add(RecordExercise recordExercise) {
        return recordExerciseMapper.insert(recordExercise);
    }

    @Override
    public boolean deleteExerciseById(Long id) {
        return recordExerciseMapper.setDisableById(id);
    }

    @Override
    public boolean updateExerciseById(RecordExercise recordExercise) {
        return recordExerciseMapper.updateExerciseById(recordExercise);
    }

    @Override
    public Long getIdByExerciseName(String exerciseName) {
        return recordExerciseMapper.getIdByExerciseName(exerciseName);
    }

    @Override
    public RecordExercise getExerciseById(Long id) {
        return recordExerciseMapper.getExerciseById(id);
    }

    @Override
    public RecordExercise getExerciseByExerciseName(String exerciseName) {
        return getExerciseByExerciseName(exerciseName);
    }

    @Override
    public List<RecordExercise> getAll() {
        return recordExerciseMapper.selectAll();
    }
}
